<%-- 
    Document   : neradni_dani
    Created on : Dec 12, 2009, 8:35:29 PM
    Author     : Milan Boricic <boricic@gmail.com>
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<link rel="stylesheet" href="./css/ui-lightness/jquery-ui-1.7.2.custom.css"/>
<script type="text/javascript" src="./js/jquery.js"></script>
<script type="text/javascript" src="./js/jquery-ui.js"></script>
<script type="text/javascript">
        $(function() {
                $("input:text[id*=datum]").datepicker({
                    dateFormat: 'dd.mm.yy.'
                });
                $("input:text[id*=datumDo]").datepicker({
                    dateFormat: 'dd.mm.yy.'
                });
        });

</script>
<h:form>
    <h:panelGrid columns="2">
        <f:facet name="header">
            <h:outputText value="Novi neradan dan:"/>
        </f:facet>

        <h:outputLabel for = "datum"
                       value = "Od datuma" />
        <h:inputText id="datum"
                     value="#{neradniDan.datumOdString}"
                     required="true"
                     requiredMessage="Niste uneli početni datum"/>

        <h:outputLabel for = "datum2"
                       value = "Do datuma" />
        <h:inputText id="datum2"
                     value="#{neradniDan.datumDoString}" />

        <h:outputLabel for = "sala"
                       value = "Sala" />
        <h:selectOneMenu id = "sala"
                         value = "#{neradniDan.salaId}"
                         required="true"
                         requiredMessage="Niste izabrali salu" >
          <f:selectItems value = "#{neradniDan.sale}" />
        </h:selectOneMenu>


        <h:outputLabel for = "razlog"
                       value = "Razlog" />
        <h:inputText id="razlog"
                     value="#{neradniDan.razlog}" >
        </h:inputText>

        <f:facet name="footer">
            <h:panelGroup style="display:block; text-align:center">
                <h:commandButton value="Unesi" action="#{neradniDan.save}" />
            </h:panelGroup>
        </f:facet>
    </h:panelGrid>
</h:form>
<h:form>
    <h:messages />
    <h:dataTable value="#{neradniDan.neradniDaniNakonDanas}"
                 var="neradan"
                 styleClass="stats"
                 style="white-space:nowrap;">
        <h:column>
            <f:facet name="header">
                <f:verbatim>Datum</f:verbatim>
            </f:facet>
            <h:outputText value="#{neradan.datum}" >
                <f:convertDateTime type="date" pattern="dd.MM.yyyy." />
            </h:outputText>
        </h:column>

        <h:column>
            <f:facet name="header">
                <f:verbatim>Sala</f:verbatim>
            </f:facet>
            <h:outputText value="#{neradan.sala.naziv}" />
        </h:column>

        <h:column>
            <f:facet name="header">
                <f:verbatim>Razlog</f:verbatim>
            </f:facet>
            <h:outputText value="#{neradan.razlog}" />
        </h:column>

        <h:column>
            <f:facet name="header">
                <f:verbatim>Evidentirao</f:verbatim>
            </f:facet>
            <h:outputText value="#{neradan.korisnik.ime}" />&nbsp;<h:outputText value="#{neradan.korisnik.prezime}" />
        </h:column>

        <h:column>
            <f:facet name="header">
                <f:verbatim>Evidentirano</f:verbatim>
            </f:facet>
            <h:outputText value="#{neradan.vremeEvidentiranja}" >
                <f:convertDateTime type="both" pattern="dd.MM.yyyy. H:mm" />
            </h:outputText>
        </h:column>

        <h:column>
            <f:facet name="header">
                <f:verbatim></f:verbatim>
            </f:facet>
            <h:commandButton value="Poništi"
                           action="#{neradan.ponisti}" />
        </h:column>
    </h:dataTable>
</h:form>


